package com.gxlevi.mr.topN;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * 自定义分区
 */
public class OrderPartition extends Partitioner<OrderBean, Text> {
    //分区规则,根据订单的ID实现分区
    @Override
    public int getPartition(OrderBean orderBean, Text text, int i) {
        return (orderBean.getOrderId().hashCode() & 2147483647) % i;
    }
}
